package com.keba.lamp.complaint.enumeration;

import com.keba.lamp.common.constant.AppendixType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

@Getter
@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "文书模板类型-枚举")
public enum DocTemplateTypeEnum {
    /**
     * 送达地址
     */
    DELIVERY__ADDRESS("01","送达地址确认书", AppendixType.Complaint.COMPLAINT__DELIVERY__ADDRESS__FILE),
    /**
     * 02银行结算确认书
     */
    SETTLE_CONFIRM("02","银行结算确认书", AppendixType.Complaint.COMPLAINT__SETTLE_CONFIRM__FILE),


    ;

    private String code;
    private String label;
    private String desc;

    public static DocTemplateTypeEnum getByCode(String code) {

        return Stream.of(DocTemplateTypeEnum.values())
                .filter(p -> p.getCode().equals(code))
                .findAny()
                .orElse(null);
    }


    public static DocTemplateTypeEnum getByDesc(String desc) {

        return Stream.of(DocTemplateTypeEnum.values())
                .filter(p -> p.getDesc().equals(desc))
                .findAny()
                .orElse(null);
    }



}
